load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")

package_group(
    name = "ddl_friend",
    packages = [
        "-//planner/...",
        "//...",
    ],
)

go_library(
    name = "ddl",
    srcs = [
        "backfilling.go",
        "backfilling_dispatcher.go",
        "backfilling_operator.go",
        "backfilling_scheduler.go",
        "callback.go",
        "cluster.go",
        "column.go",
        "constant.go",
        "constraint.go",
        "ddl.go",
        "ddl_algorithm.go",
        "ddl_api.go",
        "ddl_tiflash_api.go",
        "ddl_worker.go",
        "ddl_workerpool.go",
        "delete_range.go",
        "delete_range_util.go",
        "dist_owner.go",
        "foreign_key.go",
        "generated_column.go",
        "index.go",
        "index_cop.go",
        "index_merge_tmp.go",
        "job_table.go",
        "mock.go",
        "multi_schema_change.go",
        "options.go",
        "partition.go",
        "placement_policy.go",
        "reorg.go",
        "resource_group.go",
        "rollingback.go",
        "sanity_check.go",
        "schema.go",
        "sequence.go",
        "split_region.go",
        "stage_ingest_index.go",
        "stage_read_index.go",
        "stage_scheduler.go",
        "stat.go",
        "table.go",
        "table_lock.go",
        "ttl.go",
    ],
    importpath = "github.com/pingcap/tidb/ddl",
    visibility = [
        ":ddl_friend",
    ],
    deps = [
        "//br/pkg/lightning/common",
        "//config",
        "//ddl/ingest",
        "//ddl/internal/session",
        "//ddl/label",
        "//ddl/placement",
        "//ddl/resourcegroup",
        "//ddl/syncer",
        "//ddl/util",
        "//distsql",
        "//disttask/framework/dispatcher",
        "//disttask/framework/handle",
        "//disttask/framework/proto",
        "//disttask/framework/scheduler",
        "//disttask/framework/scheduler/execute",
        "//disttask/framework/storage",
        "//disttask/operator",
        "//domain/infosync",
        "//domain/resourcegroup",
        "//expression",
        "//infoschema",
        "//kv",
        "//meta",
        "//meta/autoid",
        "//metrics",
        "//owner",
        "//parser",
        "//parser/ast",
        "//parser/charset",
        "//parser/format",
        "//parser/model",
        "//parser/mysql",
        "//parser/opcode",
        "//parser/terror",
        "//parser/types",
        "//privilege",
        "//resourcemanager/pool/workerpool",
        "//resourcemanager/util",
        "//sessionctx",
        "//sessionctx/binloginfo",
        "//sessionctx/stmtctx",
        "//sessionctx/variable",
        "//sessiontxn",
        "//statistics",
        "//statistics/handle",
        "//store/copr",
        "//store/driver/backoff",
        "//store/helper",
        "//table",
        "//table/tables",
        "//tablecodec",
        "//tidb-binlog/pump_client",
        "//types",
        "//types/parser_driver",
        "//util",
        "//util/chunk",
        "//util/codec",
        "//util/collate",
        "//util/dbterror",
        "//util/domainutil",
        "//util/filter",
        "//util/gcutil",
        "//util/hack",
        "//util/intest",
        "//util/logutil",
        "//util/mathutil",
        "//util/memory",
        "//util/mock",
        "//util/ranger",
        "//util/resourcegrouptag",
        "//util/rowDecoder",
        "//util/rowcodec",
        "//util/set",
        "//util/slice",
        "//util/sqlexec",
        "//util/stringutil",
        "//util/syncutil",
        "//util/timeutil",
        "//util/topsql",
        "//util/topsql/state",
        "@com_github_google_uuid//:uuid",
        "@com_github_ngaut_pools//:pools",
        "@com_github_pingcap_errors//:errors",
        "@com_github_pingcap_failpoint//:failpoint",
        "@com_github_pingcap_kvproto//pkg/errorpb",
        "@com_github_pingcap_kvproto//pkg/kvrpcpb",
        "@com_github_pingcap_kvproto//pkg/metapb",
        "@com_github_pingcap_log//:log",
        "@com_github_pingcap_tipb//go-tipb",
        "@com_github_prometheus_client_golang//prometheus",
        "@com_github_tikv_client_go_v2//error",
        "@com_github_tikv_client_go_v2//kv",
        "@com_github_tikv_client_go_v2//oracle",
        "@com_github_tikv_client_go_v2//tikv",
        "@com_github_tikv_client_go_v2//tikvrpc",
        "@com_github_tikv_client_go_v2//txnkv/rangetask",
        "@com_github_tikv_client_go_v2//util",
        "@io_etcd_go_etcd_client_v3//:client",
        "@org_golang_x_sync//errgroup",
        "@org_uber_go_atomic//:atomic",
        "@org_uber_go_zap//:zap",
    ],
)

go_test(
    name = "ddl_test",
    timeout = "moderate",
    srcs = [
        "attributes_sql_test.go",
        "backfilling_dispatcher_test.go",
        "backfilling_test.go",
        "cancel_test.go",
        "cluster_test.go",
        "column_change_test.go",
        "column_modify_test.go",
        "column_test.go",
        "column_type_change_test.go",
        "constraint_test.go",
        "db_cache_test.go",
        "db_change_failpoints_test.go",
        "db_change_test.go",
        "db_foreign_key_test.go",
        "db_integration_test.go",
        "db_rename_test.go",
        "db_table_test.go",
        "db_test.go",
        "ddl_algorithm_test.go",
        "ddl_api_test.go",
        "ddl_error_test.go",
        "ddl_test.go",
        "ddl_worker_test.go",
        "ddl_workerpool_test.go",
        "export_test.go",
        "fail_test.go",
        "foreign_key_test.go",
        "index_change_test.go",
        "index_cop_test.go",
        "index_modify_test.go",
        "integration_test.go",
        "job_table_test.go",
        "main_test.go",
        "modify_column_test.go",
        "multi_schema_change_test.go",
        "mv_index_test.go",
        "options_test.go",
        "partition_test.go",
        "placement_policy_ddl_test.go",
        "placement_policy_test.go",
        "placement_sql_test.go",
        "primary_key_handle_test.go",
        "reorg_partition_test.go",
        "repair_table_test.go",
        "restart_test.go",
        "rollingback_test.go",
        "schema_test.go",
        "sequence_test.go",
        "stat_test.go",
        "table_modify_test.go",
        "table_split_test.go",
        "table_test.go",
        "tiflash_replica_test.go",
        "ttl_test.go",
    ],
    embed = [":ddl"],
    flaky = True,
    shard_count = 50,
    deps = [
        "//autoid_service",
        "//config",
        "//ddl/ingest",
        "//ddl/internal/session",
        "//ddl/placement",
        "//ddl/schematracker",
        "//ddl/syncer",
        "//ddl/testutil",
        "//ddl/util",
        "//ddl/util/callback",
        "//disttask/framework/proto",
        "//domain",
        "//domain/infosync",
        "//errno",
        "//executor",
        "//infoschema",
        "//keyspace",
        "//kv",
        "//meta",
        "//meta/autoid",
        "//parser",
        "//parser/ast",
        "//parser/auth",
        "//parser/charset",
        "//parser/model",
        "//parser/mysql",
        "//parser/terror",
        "//parser/types",
        "//planner/core",
        "//server",
        "//session",
        "//sessionctx",
        "//sessionctx/stmtctx",
        "//sessionctx/variable",
        "//sessiontxn",
        "//store/gcworker",
        "//store/helper",
        "//store/mockstore",
        "//table",
        "//table/tables",
        "//tablecodec",
        "//testkit",
        "//testkit/external",
        "//testkit/testsetup",
        "//testkit/testutil",
        "//types",
        "//util",
        "//util/chunk",
        "//util/codec",
        "//util/collate",
        "//util/dbterror",
        "//util/domainutil",
        "//util/gcutil",
        "//util/logutil",
        "//util/mathutil",
        "//util/mock",
        "//util/sem",
        "//util/sqlexec",
        "@com_github_ngaut_pools//:pools",
        "@com_github_pingcap_errors//:errors",
        "@com_github_pingcap_failpoint//:failpoint",
        "@com_github_stretchr_testify//assert",
        "@com_github_stretchr_testify//require",
        "@com_github_tikv_client_go_v2//oracle",
        "@com_github_tikv_client_go_v2//testutils",
        "@com_github_tikv_client_go_v2//tikv",
        "@com_github_tikv_client_go_v2//util",
        "@io_etcd_go_etcd_client_v3//:client",
        "@org_golang_google_grpc//:grpc",
        "@org_uber_go_atomic//:atomic",
        "@org_uber_go_goleak//:goleak",
        "@org_uber_go_zap//:zap",
    ],
)
